<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>一个演示ajax的静态页面</title>
</head>
<body>
<div id="content"></div>
<button id="btn">请求服务端接口</button>
<script>
    document.getElementById("btn").onclick = function () { // 点击事件
        let xmlHttp = new XMLHttpRequest();
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                document.getElementById("content").innerHTML = xmlHttp.responseText;
            }
        };
        xmlHttp.open("POST", "form_1.php", true);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlHttp.send('name=盘古');
    };
</script>
</body>
</html>